{extend name="Public:base" /}

{block name="title"}
<title>hardphp网站编程技术</title>
<meta name="keywords" content="网站编程技术、web开发、微信开发、hardphp"/>
<meta name="description" content="hardphp关注web开发技术与资讯，分享web开发经验。"/>
{/block}
{block name="stylejs"}

<link rel="stylesheet" href="{$Think.WWW_ROOT}/public/static/common/dropload/dropload.css">
<script type="text/javascript" src="{$Think.WWW_ROOT}/public/static/common/layerm/layer.js" ></script>
<script type="text/javascript" src="{$Think.WWW_ROOT}/public/static/common/dropload/dropload.js" ></script>
{/block}

{block name="content"}

<!--内容-->
<div class="col-md-9 col-sm-12 col-xs-12 ">
	<div class="content-wapper clearfix content">
		<!--分类-->
		<div class="positions">
			<ol class="breadcrumb breadcrumb-self">
				<li>{$keyword}</li><li class="active">{$total}篇</li>
			</ol>
		</div>
		<!--分类-->
		<div class="conent-newest clearfix lists">
		</div>
	</div>
</div>
<!--内容-->
{/block}

{block name="js"}
<script type="text/javascript">
	
	$(function(){
		var page = 1;
		var keyword = "{$keyword}";
		var listsUrl = "{:url('index/lists')}?";
		var detailUrl = "{:url('index/detail')}?";
		
		$('.content').dropload({
			scrollArea : window,
			domUp : {
				domClass   : 'dropload-up',
				domRefresh : '<div class="dropload-refresh">↓下拉刷新</div>',
				domUpdate  : '<div class="dropload-update">↑释放更新</div>',
				domLoad    : '<div class="dropload-load"><span class="loading"></span>加载中...</div>'
			},
			domDown : {
				domClass   : 'dropload-down',
				domRefresh : '<div class="dropload-refresh">↑上拉加载更多</div>',
				domLoad    : '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
				domNoData  : '<div class="dropload-noData">没有了</div>'
			},
			loadUpFn : function(me){
				page = 1;
				getMoreData(me);
				me.resetload();
			},
			loadDownFn : function(me){
				getMoreData(me);
			},
			threshold : 50
		});
		 
		function getMoreData(me){
			$.get('{:url("index/getArticles")}',{page:page,keyword:keyword},function(data){
			
				var list = data.data;
				var html = '';
				if(list.length > 0){
					for(var i = 0;i < list.length;i++){
						html+= '<article class="excerpt clearfix">'
								+ '<header>'
								+ '<a class="label-self label-important" href="'+ listsUrl +'cid=' + list[i].cid + '">' + list[i].ctitle + '</a>'
								+ '	<h2><a href="'+ detailUrl +'id=' + list[i].id + '&cid=' + list[i].cid + '" title="' + list[i].title + '"> ' + list[i].title + '</a></h2>'
								+ '</header>';
						if (list[i].img){
							html+= '<div class="focus">'
								+ '<a href="'+ detailUrl +'?id=' + list[i].id + '&cid=' + list[i].cid + '"><img class="thumb" src="' + list[i].img + '200_124.jpg" alt="' + list[i].title + '"></a>'
								+ '</div>';
						}
						html+= '<span class="note">' + list[i].descript + '</span>'
							+ '<div class="auth-span">'
							+ '<span class="muted"><span class="glyphicon glyphicon-time"></span> ' + list[i].addTime + '</span>'
							+ '<span class="muted"><span class="glyphicon glyphicon-eye-open"></span> ' + list[i].click + '</span>'
							+ '<span class="muted"><span class="glyphicon glyphicon-comment"></span><a href="javascript:void(0)"> ' + list[i].comment + '评论</a></span>'
							+ '</div>'
							+ '</article>';
					}
					if(page == 1){
						$('.lists').html(html);
						me.unlock();
						me.noData(false);
					}else{
						$('.lists').append(html);
					}
					 
				}else{
					// 锁定
					me.lock();
					// 无数据
					me.noData(); 
				}
				page++;
				//插件状态重置
				me.resetload();  
			});
		}
		
		 
	});
 
</script>
{/block}